<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <ui:composition template="/view/retail/template.xhtml">
        <ui:define name="content">
            <f:view>
                <h:form>
                    <h1 class="ui-widget-header ui-corner-all">#{trafficManager.trafficTitle}</h1>
                    <p:dialog modal="true" draggable="false" header="查询联系人" widgetVar="contactDialog">
                        <ui:include src=""></ui:include>
                    </p:dialog>


                    <p:panel>
                        <h:panelGrid columns="4" width="100%" title="来店信息" headerClass="subtitlebig" styleClass="ui-widget-content" columnClasses="column1,column2,column3,column4">
                            <h:outputLabel value="来访目的:" for="inclination" />
                            <h:selectOneMenu value="#{trafficManager.traffic.inclination}" title="Inclination" id="inclination" >
                                <f:selectItems value="#{applicationBean.inclinationItems}"></f:selectItems>
                            </h:selectOneMenu>
                            <h:outputLabel value="信息来源" for="source" />
                            <h:selectOneMenu value="#{trafficManager.traffic.source}" title="Source" id="source">
                                <f:selectItems value="#{applicationBean.sourceItems}"></f:selectItems>
                            </h:selectOneMenu>
                        </h:panelGrid>
                        <h:panelGrid columns="2">
                            <h:outputLabel value="客户关注:" for="emphasis" />
                            <h:selectManyCheckbox value="#{trafficManager.traffic.emphasisArray}" styleClass="selectManyMenu"  id="emphasis">
                                <f:selectItems value="#{applicationBean.emphasisItems}" ></f:selectItems>
                            </h:selectManyCheckbox>
                            <h:outputLabel value="商家比较:" for="competitor" />
                            <h:selectManyCheckbox value="#{trafficManager.traffic.competitorArray}"  styleClass="selectManyMenu" id="competitor" >
                                <f:selectItems value="#{applicationBean.competitorItems}"></f:selectItems>
                            </h:selectManyCheckbox>
                            <h:outputLabel value="咨询记录" for="description" />
                            <h:inputTextarea id="description" label="咨询记录" value="#{trafficManager.traffic.description}" title="Description" cols="50" rows="3" ></h:inputTextarea>
                            <h:outputLabel value="创建潜在客户" />
                            <h:selectBooleanCheckbox></h:selectBooleanCheckbox>
                        </h:panelGrid>
                    </p:panel>

                    <p:panel id="contactPanel" header="联系人信息" collapsed="true" widgetVar="panelWidget" >
                        <h:form>
                            <h:panelGrid columns="4" width="100%" title="基本信息" headerClass="subtitlebig" columnClasses="column1,column2,column3,column4">
                                <h:outputLabel value="姓氏" for="msalutation" />
                                <h:panelGroup >
                                    <h:inputText id="msalutation" value="#{contactManager.currentContact.surname}" title="Surname" />
                                    <h:selectOneMenu value="#{contactManager.currentContact.saluation}">
                                        <f:selectItem itemLabel="先生" itemValue="先生"/>
                                        <f:selectItem itemLabel="女士" itemValue="女士"/>
                                    </h:selectOneMenu>
                                </h:panelGroup>
                                <h:outputLabel value="名字:" for="mname" />
                                <h:inputText id="mname" value="#{contactManager.currentContact.name}" title="Name" />
                                <h:outputLabel value="公司" for="mcompany" />
                                <h:inputText id="mcompany" value="#{contactManager.currentContact.company}"  size="20" title="Company" />
                                <h:outputLabel value="生日" for="mbirthday" />
                                <p:calendar  id ="mbirthday" value="#{contactManager.currentContact.birthday}" navigator="true"  ></p:calendar>
                                <h:outputLabel value="结婚日期" for="mmarriageDate" />
                                <p:calendar  id ="mmarriageDate" value="#{contactManager.currentContact.marriageDate}" navigator="true" ></p:calendar>
                                <h:outputLabel value="移动电话" for="mmobilePhone" />
                                <p:inputMask id="mmobilePhone" value="#{contactManager.currentContact.mobilePhone}" mask="99999999999"></p:inputMask>
                                <h:outputLabel value="固定电话" for="mhomePhone" />
                                <p:inputMask id="mhomePhone" value="#{contactManager.currentContact.homePhone}" title="homePhone" mask="(9999)9999999? x99999"></p:inputMask>
                                <h:outputLabel value="地址" for="maddress" />
                                <h:inputText id="maddress" value="#{contactManager.currentContact.address}" title="address" size="20" />
                            </h:panelGrid>
                        </h:form>
                        <f:facet name="options" >
                            <p:menu >
                                <p:submenu label="选项" >
                                    <p:menuitem value="新增" url="#"
                                                icon="/resources/images/add.png"  actionListener="#{contactManager.create}" oncomplete="panelWidget.toggle();" update="contactPanel"/>
                                    <p:menuitem value="查询" url="#"
                                                icon="/resources/images/search.png"  onclick="panelWidget.toggle();contactDialog.show();" />
                                </p:submenu>
                            </p:menu>
                        </f:facet>
                    </p:panel>
                    <h:panelGroup>
                        <p:commandButton value="保存" ajax="false"  action="#{trafficManager.save}"></p:commandButton>
                        <p:commandButton value="取消" ajax="false"  action="detail"></p:commandButton>
                    </h:panelGroup>
                </h:form>
            </f:view>
        </ui:define>
    </ui:composition>
</html>
